﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Sample03_Scene
{
    public partial class NPCPanel : UserControl, IUserInterface
	{
		public NPCPanel()
		{
			// Required to initialize variables
			InitializeComponent();
            ANI_Close.Completed += new EventHandler(ANI_Close_Completed);
            this.Visibility = System.Windows.Visibility.Collapsed;
		}


        void ANI_Close_Completed(object sender, EventArgs e)
        {
            this.Visibility = System.Windows.Visibility.Collapsed;
        }

		private void Click_Close(object sender, System.Windows.RoutedEventArgs e)
		{
            Close();
		}


        public void Show()
        {
            var p = (this.Parent as FrameworkElement).Parent as FrameworkElement;
            Canvas.SetLeft(this, p.ActualWidth / 2 - grid.Width / 2);
            Canvas.SetTop(this, p.ActualHeight / 2 - grid.Height / 2);
            Visibility = System.Windows.Visibility.Visible;
            ANI_Show.Begin();
        }

        public void Close()
        {
            ANI_Close.Begin();
        }
    }
}